﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ProductMaster.aspx.cs" Inherits="Main_Master_ProductMaster" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <script src="../../JavaScript/Commons.js" type="text/javascript"></script>
    <script type="text/javascript">
        function checkValidation() {
            if (document.getElementById("txtpeccode").value == '') 
            {
                document.getElementById("lblmsg").innerHTML = "Please Enter PE Code.";
                document.getElementById("lblmsg").style["display"] = "block";
                document.getElementById("lblmsg").style["color"] = "#B90000";
                //document.getElementById("txtpeccode").focus();
                return false;
            }
            else if (document.getElementById("txtprojectmodel").value == '') 
            {                
                document.getElementById("lblmsg").innerHTML = "Please Enter Project Model.";
                document.getElementById("lblmsg").style["display"] = "block";
                document.getElementById("lblmsg").style["color"] = "#B90000";
                //document.getElementById("txtprojectmodel").focus();
                return false;
            }
            return true;          
        }
        function hidemsg() {
            document.getElementById("lblmsg").style["display"] = "none";
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <acc:heading ID="header1" runat="server" HeadingText="Product Master" />         
    <div align="center" style="width: 100%;"> 
        <asp:Label ID="lblmsg" runat="server" style="display:none;"></asp:Label>
        <table class="tablecontent">
            <tr>
                <td colspan="4" class="headtd">
                    Product Master
                </td>
            </tr>
            <tr>
                <td style="width: 60px;">
                </td>
                <td style="width: 117px;">
                    PE Code<span style="color: Red;">*</span>
                </td>
                <td style="width: 111px;">
                    <asp:TextBox ID="txtpeccode" MaxLength="10" runat="server" Width="200px" CssClass="inputnumber"
                        onfocus="hidemsg();" Style="text-align: left;" ToolTip="Pre Engineering Code"></asp:TextBox>
                </td>
                <td style="width: 60px;">
                </td>
            </tr>
            <tr>
                <td style="width: 60px;">
                </td>
                <td style="width: 117px;">
                    Product Model<span style="color: Red;">*</span>
                </td>
                <td style="width: 111px;">
                    <asp:TextBox ID="txtprojectmodel" MaxLength="120" Width="200px" onfocus="hidemsg();" runat="server" CssClass="inputnumber"
                        Style="text-align: left;"></asp:TextBox>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td style="width: 60px;">
                </td>
                <td style="width: 117px;">
                    Product Desc
                </td>
                <td style="width: 111px;">
                    <asp:TextBox ID="txtprojectdesc" runat="server" onfocus="hidemsg();" Width="200px" MaxLength="150" CssClass="inputnumber"
                        Style="text-align: left;"></asp:TextBox>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>                    
                </td>
                <td>
                    <asp:Button ID="btnSave" runat="server" Text="Save" CssClass="button" OnClick="btnSave_Click"
                        OnClientClick="return checkValidation();" />&nbsp;
                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" CssClass="button" OnClick="btnCancel_Click" />
                </td>
                <td>
                </td>
            </tr>
        </table>
    </div>
    <div align="center" style="width: 100%; margin-top: 10px;">
        <table class="tablecontent" width="70%">
            <tr>
                <td class="headtd">
                    Product Master Details
                </td>
            </tr>
            <tr>
                <td>
                    <asp:HiddenField ID="hidproduct" runat="server" />
                    <asp:GridView ID="grdproductmaster" runat="server" AutoGenerateColumns="false" CssClass="gridview"
                        DataKeyNames="id" Width="100%" OnRowEditing="grdproductmaster_RowEditing" AlternatingRowStyle-CssClass="gridview_alternate"
                        AllowPaging="True" OnPageIndexChanging="grdproductmaster_PageIndexChanging" RowStyle-CssClass="gridviewitem">
                        <AlternatingRowStyle CssClass="gridview_alternate"></AlternatingRowStyle>
                        <Columns>
                            <asp:TemplateField ItemStyle-HorizontalAlign="Center">
                                <HeaderTemplate>
                                    <asp:Label ID="lblhedsrno" runat="server" Text="S. No." Font-Bold="true"></asp:Label>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <%#Container.DataItemIndex+1%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Label ID="lblhedpeccode" runat="server" Text="PE Code" Font-Bold="true"></asp:Label>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblpeccode" runat="server" Text='<%#Bind("peccode")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Label ID="lblhedprojmodel" runat="server" Text="Product Model" Font-Bold="true"></asp:Label>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblprojectmodel" runat="server" Text='<%#Bind("projectmodel")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <asp:Label ID="lblhedprojdesc" runat="server" Text="Product Desc" Font-Bold="true"></asp:Label>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblprojectdesc" runat="server" Text='<%#Bind("projectdesc")%>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Edit">
                                <ItemTemplate>
                                    <%--   <asp:LinkButton ID="lnkbtnEdit" runat="server" CausesValidation="False"
                                            CommandName="Edit" Text="Edit" CommandArgument='<%#Eval("Id")%>' 
                                            onclick="lnkbtnEdit_Click"></asp:LinkButton> --%>
                                    <asp:ImageButton ID="lnkbtnEdit" runat="server" CausesValidation="false" CommandName="Edit"
                                        CommandArgument='<%#Eval("Id")%>' OnClick="lnkbtnEdit_Click" ImageUrl="../../Menu/images/Edit_user.png" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <RowStyle CssClass="gridviewitem"></RowStyle>
                    </asp:GridView>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
